﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;

namespace HQWeb.View
{
    /// <summary>
    /// GetFistFile 的摘要说明
    /// </summary>
    public class GetFistFile : IHttpHandler, IReadOnlySessionState
    {
        public static List<Model.View.V_FistFile> AllFileList;
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string strResout = "";
            //context.Response.Write("Hello World");
            if (context.Session["BRANCH_ID"] != null)
            {
                int strBranchID = Convert.ToInt32(context.Session["BRANCH_ID"].ToString());
                if (AllFileList == null)
                {
                    BLL.View.V_FistFile bll = new BLL.View.V_FistFile();
                    AllFileList = bll.GetListArray("");
                }
                string strType = context.Request["type"].Trim();
                Model.View.V_FistFile model = AllFileList.Find(p => p.MODULE == strType && p.BRANCH_ID == strBranchID);
                if (model != null)
                {
                    strResout = model.URLOriginal;
                }
                context.Response.Write(strResout);
            }
            else
            {
                context.Response.Write("SessionTimeout");
            }
        }
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}